/**
 * 自定义分页标签结构或属性的类
 * 
 */
package com.brilliance.project.common.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class PageTag extends ComponentTagSupport {

	/**
     * 
     */
	private static final long serialVersionUID = 1L;
	// 当前页码
	private String curPageNo = null;
	// 总页码
	private String total = null;
	// 总笔数
	private String totalRecord = null;
	// 分页样式
	private String styleClass = "paginationSpan";
	// action的路径
	private String url = null;
	// action的方法
	private String method = null;
	// action
	private String action = null;

	public String getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(String totalRecord) {
		this.totalRecord = totalRecord;
	}

	public String getCurPageNo() {
		return curPageNo;
	}

	public void setCurPageNo(String curPageNo) {
		this.curPageNo = curPageNo;
	}

	public String getTotal() {
		return total;
	}

	public void setTotal(String total) {
		this.total = total;
	}

	public String getStyleClass() {
		return styleClass;
	}

	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	@Override
	public Component getBean(ValueStack vs, HttpServletRequest request,
			HttpServletResponse response) {
		return new Pages(vs, request);
	}

	protected void populateParams() {
		super.populateParams();

		Pages pages = (Pages) component;
		pages.setCurPageNo(curPageNo);
		pages.setTotal(total);
		pages.setTotalRecord(totalRecord);
		pages.setStyleClass(styleClass);
		pages.setUrl(url);
		pages.setMethod(method);
		pages.setAction(action);
	}

	/**
	 * Release any acquired resources.
	 */
	public void release() {
		super.release();
	}

}
